/**
 *
 */
package org.tim.robot.fenixos;

import java.util.*;
import java.net.*;
import java.lang.*;
import org.tim.collections.DefaultValueList;

/**
 * 
 * @author Tim Fennis
 */
public abstract class Application {
	
	private DefaultValueList<Connection> connections = new DefaultValueList<Connection>();
	private int lastcid = 0;
	
	/**
	 * TODO: Implement system properties
	 *
	 */
	public int connect ( String ip ) {
		return connect ( ip , 1337 );
	}
	
	/**
	 *
	 */
	public int connect ( String ip , int port ) {
		return connections.add(new Connection( ip , port ));
	}
	
	/**
	 *
	 */
	public void send ( String message ) throws Exception {
		send ( message , connections.getDefault() );
	}
	
	/**
	 *
	 */
	public void send ( String message , int cid ) throws Exception {
		send ( message , connections.get(cid) );
	}
	
	/**
	 *
	 */
	public void send ( String message , Connection c ) throws Exception {
		c.send(message);
	}
}